import java.util.Scanner;


public class Test2_4 {
	public static void main(String[] args){
//		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
//		String[] str = new String[n];
//		for(int i=0;i<n;i++){
//			str[i] = sc.next();
//		}
		int n=5;
		String str1 = null,a,b;
		String[] str={
				"466272307503271156",
				"215856472207097978",
				"234804580401078365",
				"404475727700034980",
				"710351408803093165"};
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				a = str[i].substring(6, 10);
				b = str[j].substring(6, 10);
				if(Integer.parseInt(a)<Integer.parseInt(b)){
					str1 = str[i];
					str[i] = str[j];
					str[j] = str1;
				}
				else if(a==b){
				}
			}
		}
		for(int i=0;i<n;i++){
			System.out.println(""+str[i]);
		}
	}
}
